MOOC Utils

Utils like auto assignment solver extension and course notice announcment notification for MOOC courses

Extension overview

Introduction#

Assignment Solver helps with online assignments on platforms like NPTEL and Coursera. It uses Gemini to extract and work through questions, offers Study Hints and Auto-Solve, and keeps processing on the client with a bring-your-own API key. Screenshots, export, and Chrome/Firefox support are part of the package.

Project structure#

The extension follows a modular design organized by responsibility:

  • src/background: Service worker and message routing
  • src/content: Content script for DOM extraction and answer application
  • src/ui: Side panel UI and controllers
  • src/services: Business logic (Gemini integration, storage)
  • src/platform: Cross-browser adapters and runtime utilities
  • src/core: Shared types, messages, and logging
  • public: Static assets (side panel HTML/CSS/icons)

Core components#

  • Dual-mode operation:
  • Study Hints: Retrieve explanations and reasoning without revealing direct answers.
  • Auto-Solve: Automatically extract, analyze, fill, and submit assignments.
  • Supported question types:
  • Single-choice (radio)
  • Multi-choice (checkbox)
  • Fill-in-the-blank (text/number input)
  • Image-based (full-page screenshots and embedded images are included in prompts)
  • Privacy-first client-side processing:
  • API key stored locally and never sent to third-party servers.
  • All AI requests are made directly to Google’s Gemini endpoints.
  • BYOK and export:
  • Users configure their own Gemini API key in the side panel.
  • Export options include full extraction and answer-only exports.
  • Cross-browser compatibility:
  • Unified browser API via webextension-polyfill.
  • Separate manifests for Chrome (side panel) and Firefox (sidebar action).

Architecture overview#

The extension communicates through a well-defined message bus between the side panel, background service worker, and content script. The background worker coordinates tasks, captures screenshots, and orchestrates Gemini API calls. The content script interacts with the assignment page to extract HTML and apply answers. The side panel provides user controls and displays progress/results.

Detailed component analysis#

Side panel UI and controllers#

The side panel provides a guided workflow:

  • Assignment detection and display of title/count
  • Solve button with auto-submit toggle
  • Progress steps (Extract → Analyze → Fill → Submit)
  • Results display with AI reasoning and confidence
  • Settings modal for API key and model selection

Background service worker#

The background worker initializes platform adapters, registers message handlers, and manages extension lifecycle:

  • Health checks, page info retrieval, screenshot capture
  • Routing messages to appropriate handlers
  • Opening/closing the side panel and responding to icon clicks

Content script#

The content script runs on assignment pages and handles DOM interactions:

  • Extracts page HTML and images
  • Captures scroll info and scrolls to positions for screenshots
  • Applies answers (radio, checkbox, text input)
  • Submits assignments and relays debug info

Gemini service#

The Gemini service constructs prompts and payloads, manages thinking budgets, and performs direct API calls:

  • Builds content parts from HTML, images, screenshots, and extracted data
  • Configures reasoning levels and thinking budgets per model family
  • Calls Gemini with extraction and solving schemas
  • Parses responses and surfaces errors

Storage and export#

The storage service persists keys, caches extractions, and supports export:

  • API key storage in local storage
  • Extraction cache with timestamps
  • Export formats: full extraction and answer-only export

Dependency analysis#

  • Cross-browser compatibility is achieved via webextension-polyfill and platform adapters.
  • Message routing centralizes background handlers and keeps the message channel open until async responses finish.
  • UI state management tracks processing state and current extraction for rendering.

Performance considerations#

  • Rate limiting and delays:
  • 500ms delay between answer API calls
  • 200ms delay between DOM operations
  • Recursive splitting:
  • Automatic splitting of HTML and question sets to avoid MAX_TOKENS errors
  • Thinking budgets:
  • Configurable reasoning levels mapped to token budgets per model family
  • Screenshot capture:
  • Full-page screenshots are captured and sent to Gemini to improve accuracy for image-based questions

Troubleshooting guide#

Common issues and resolutions:

  • Could not get page HTML: Ensure you are on a valid assignment page and refresh.
  • Question container not found: Re-extract questions; check console for details.
  • API Key invalid: Verify the key at Google AI Studio and ensure it has Gemini access.
  • Answers not being applied: Some platforms use custom components; inspect console and apply answers individually.
  • Rate limit errors: Wait before retrying, consider upgrading quota, or reduce concurrent questions.

Conclusion#

BYOK, two modes, client-side only. That privacy stance is the product constraint, not a slogan.